package proxy;

import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * This class is the representation of a single entry that has been stored into the cache 
 */
public class CacheEntry {
	private static SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
	private Date expirationDate;
	private byte[] data;
	
	public CacheEntry(String dateString, byte[] data) throws Exception{
		expirationDate = df.parse(dateString);
		this.data = data;
	}
	
	/**
	 * Get a string representation of the expiration date.
	 * @return string
	 */
	public String getExpirationDateString(){
		return df.format(expirationDate);
	}
	
	/**
	 * Get the expiration date
	 * @return Date expiration object
	 */
	public Date getExpirationDate(){
		return expirationDate;
	}
	
	/**
	 * Return the respose byte array.
	 * @return
	 */
	public byte[] getData(){
		return data;
	}
}
